<?php

/**
 * This is the model class for table "wxplatform".
 *
 * The followings are the available columns in table 'wxplatform':
 * @property string $id_wxplatform
 * @property string $appid
 * @property string $appsecret
 * @property string $key
 * @property string $mchid
 * @property string $qrcodefollow
 * @property string $sms_tmpid_regsuccess
 * @property string $sms_tmpid_paysuccess
 * @property string $sms_tmpid_rechargesuccess
 * @property string $sms_tmpid_exchangeautosuccess
 * @property string $sms_tmpid_exchangemanualsuccess
 * @property string $sms_tmpid_ticketsexpire
 * @property string $sms_tmpid_wakeup
 * @property string $createtime
 * @property string $type
 */
 

class Wxplatform extends ActiveRecord
{
	const DEFAULT_ID = 1;
	
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Merchant the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'wxplatform';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('qrcodefollow, id_wxplatform, appid, appsecret, key, mchid, sms_tmpid_regsuccess, sms_tmpid_paysuccess, sms_tmpid_rechargesuccess, sms_tmpid_exchangeautosuccess, sms_tmpid_exchangemanualsuccess, sms_tmpid_ticketsexpire, sms_tmpid_wakeup, createtime, type', 'safe'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		return array(
		);
	}
	
	public function getQrsrcFollow()
	{
		return app()->params['QR_BASEURL'] . '/' . $this->qrcodefollow;
	}
	
	public static function getDefaultPlatform()
	{
		return self::model()->findByPk(self::DEFAULT_ID);
	}
}
